<template>
	<view>
		<!-- 与包裹页面所有内容的元素u-page同级，且在它的下方 -->
		<u-tabbar active-color="#FF6A60" v-model="current" :list="list" @change="tabChange"></u-tabbar>
	</view>
</template>
<script setup>
	import {
		ref,
		watch,
		onMounted
	} from 'vue'

    import { onShow } from '@dcloudio/uni-app';
	const list = [{
			iconPath: "a-Frame20",
			selectedIconPath: "a-Frame20",
			text: '发现',
			path: '/pages/index/index',
			customIcon: true
		},
		{
			iconPath: "huangguan",
			selectedIconPath: "huangguan",
			text: '我的',
			path: '/pages/creator/creator',
			customIcon: true
		},
	]
	const props = defineProps({
		activeIndex: {
			type: Number,
			default: 0
		}
	})
	let current = ref(0)
	onShow(() => {
		current.value = props.activeIndex
	})
	const tabChange = (index) => {
		vk.switchTab(list[index].path);
	}
</script>